-ifdef(DEBUG).
-define(DEBUG(Format, Args), io:format("[debug]~w:~w => " ++ Format, [?MODULE, ?LINE|Args])).
-else.
-define(DEBUG(Format, Args), ok).
-endif.

-define(WARN(Format, Args), io:format("[warn]~w:~w => " ++ Format, [?MODULE, ?LINE|Args])).

-define(IF(C, T, F), (case (C) of true -> (T); false -> (F) end)).

-define(INDEX_TYPE_INVALID, 0).
-define(INDEX_TYPE_PRIMARY_KEY, 1).
-define(INDEX_TYPE_INDEX, 2).
-define(INDEX_TYPE_FOREIGN_KEY, 3).

-define(EMYSQL_SOURCE_POOL_ID, erl_sql_source_pool).
-define(EMYSQL_DEST_POOL_ID, erl_sql_dest_pool).

-record(table_field, {
    name = "",
    sql = ""
}).

-record(table_index, {
    name = "",
    type = ?INDEX_TYPE_INVALID,
    sql = ""
}).

-record(table_schema, {
    table = "",
    sql = "",
    field_list = [] :: [#table_field{}],
    index_list = [] :: [#table_index{}]
}).

-define(COMPARE_SIDE_SOURCE, 1).
-define(COMPARE_SIDE_DEST, 2).

-record(schema_sync, {
    side = ?COMPARE_SIDE_SOURCE,
    url = "",
    type = file :: file | mysql,
    table_list = [] :: [#table_schema{}]
}).
